//
//  ZLikeViewController.m
//  ZQLearn
//
//  Created by macfeel on 2019/4/21.
//  Copyright © 2019 macfeel. All rights reserved.
//

#import "ZLikeViewController.h"
#import "ZSubLikeViewController.h"
@interface ZLikeViewController ()<ZJScrollPageViewDelegate>

/**
 页面分栏的标题
 */
@property (strong,nonatomic) NSArray<NSString *>*titles;

/**
 横向分页滑动组件
 */
@property (strong,nonatomic) ZJScrollPageView *scrollPageView;

@end

@implementation ZLikeViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    [self.navigationItem setItemWithTitle:@"我的收藏" textColor:kNavigationTitleColor fontSize:18 itemType:center];
//    [self showNoDataImageView:@"none" withTitle:@"暂无数据哦"];
    
    
    ZJSegmentStyle *style = [[ZJSegmentStyle alloc] init];
    //显示滚动条
    style.showLine = YES;
    // 颜色渐变
    style.gradualChangeTitleColor = YES;
    style.scrollTitle = YES;
    style.scrollLineColor = NColorFrom16RGB(0x23b7e5);
    style.selectedTitleColor = NColorFrom16RGB(0x23b7e5);
    style.segmentViewBounces = YES;
    style.titleFont = kFont15;
    style.adjustCoverOrLineWidth = YES;
    style.autoAdjustTitlesWidth = YES;
    style.segmentHeight = 45;
    self.titles = @[@"资讯",
                    @"视频",
                    @"书籍",];
    //    self.titles = [self.dataArray copy];
    // 初始化
    _scrollPageView = [[ZJScrollPageView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight - 20.0) segmentStyle:style titles:self.titles parentViewController:self delegate:self];
    [self.view addSubview:_scrollPageView];
    // Do any additional setup after loading the view.
}

//catelogType ///1 文本电子书  2绘本或图片（其实就是pdf图）
#pragma mark ZJPhotoScrollViewDelegate
- (NSInteger)numberOfChildViewControllers {
    return self.titles.count;
}

- (UIViewController<ZJScrollPageViewChildVcDelegate> *)childViewController:(UIViewController<ZJScrollPageViewChildVcDelegate> *)reuseViewController forIndex:(NSInteger)index {
    
    ///两种写法都可以，下面的方法可以方便的传值
    
    //    UIViewController<ZJScrollPageViewChildVcDelegate> *childVc = reuseViewController;
    ZSubLikeViewController *childVc = (ZSubLikeViewController *)reuseViewController;
    if (!childVc) {
        
        childVc = [[ZSubLikeViewController alloc] init];
        //        childVc.Id = model.ID;
        //        if (self.dataArray.count>0) {
        //            childVc.dataArray = [self.dataArray copy];
        //        }
        
    }
    return childVc;
}

- (BOOL)shouldAutomaticallyForwardAppearanceMethods{
    return NO;
}



@end
